package com.ptswitch.material.admcmd.cmds;

import io.netty.channel.ChannelHandlerContext;

import com.ptswitch.material.admcmd.AbstractAdmCmdImpl;
import com.ptswitch.material.admcmd.AdmAccount;
import com.ptswitch.material.admcmd.AdmCmd;
import com.ptswitch.material.admcmd.ChannelDataConsts;
import com.ptswitch.material.util.Gs;

public class WhoamiAdmCmd extends AbstractAdmCmdImpl implements AdmCmd {

    public WhoamiAdmCmd() {
        super("whoami");
    }

    @Override
    public void execute(String cmdLine, ChannelHandlerContext ctx) {
        AdmAccount admAccount = (AdmAccount) Gs.getAdmClientManager().getChannelData(ctx.channel()).get(ChannelDataConsts.AdmAccount);
        ctx.writeAndFlush(admAccount.getName() + "\r\n");
    }

}
